export function MP(ak) {
  return new Promise(function (resolve, reject) {
    window.onload = function () {
      resolve(BMap)
    }
    // let mapScript = document.createElement('script')
    // mapScript.type = 'text/javascript'
    // mapScript.src = `http://api.map.baidu.com/api?v=2.0&ak=${ak}&callback=init`
    // mapScript.onerror = reject
    let mapLibScript = document.createElement('script')
    mapLibScript.type = 'text/javascript'
    mapLibScript.src = 'http://api.map.baidu.com/library/SearchInfoWindow/1.5/src/SearchInfoWindow_min.js'
    mapLibScript.onerror = reject
    // document.head.appendChild(mapScript)
    document.head.appendChild(mapLibScript)
  })
}